/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import exception.DuplicateConstraintException;
import exception.ExceptionInterceptor;
import exception.RemoveConstraintException;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.interceptor.Interceptors;
import model.dao.FormacaoDao;
import model.entidades.Formacao;

/**
 *
 * @author helton
 */
@Named
@Stateless
@Interceptors(ExceptionInterceptor.class)
public class FormacaoController implements Serializable {

    @Inject
    FormacaoDao formacaoDao;

    public Formacao insert(Formacao formacao) throws DuplicateConstraintException {
        formacaoDao.insert(formacao);
        return formacao;
    }

    public Formacao update(Formacao formacao) throws DuplicateConstraintException {
        formacaoDao.update(formacao);
        return formacao;
    }

    public void remove(Formacao formacao) throws RemoveConstraintException {
        formacaoDao.delete(formacao);
    }

    public List<Formacao> getAll(Long profis) {
        return formacaoDao.getAll(profis);
    }
}
